import com.sun.source.tree.Tree;

/**
 * @author zx
 * @date date 2019-11-28 17:30:48
 */
public class MirrorRecursive {
    static class TreeNode{
        TreeNode left,right;
        int value;
        public TreeNode(int val){
            this.value = val;
        }
    }

    private static void recursiveTreeNode(TreeNode treeNode){
        if(treeNode == null){
            return ;
        }
        if(treeNode.left == null && treeNode.right == null){
            return ;
        }
        else{
            TreeNode temp = treeNode.left;
            treeNode.left = treeNode.right;
            treeNode.right = temp;
        }
        recursiveTreeNode(treeNode.left);
        recursiveTreeNode(treeNode.right);
    }

    public static void prettyPrintTree(TreeNode node, String prefix, boolean isLeft) {
        if (node == null) {
            System.out.println("Empty tree");
            return;
        }

        if (node.right != null) {
            prettyPrintTree(node.right, prefix + (isLeft ? "│   " : "    "), false);
        }

        System.out.println(prefix + (isLeft ? "└── " : "┌── ") + node.value);

        if (node.left != null) {
            prettyPrintTree(node.left, prefix + (isLeft ? "    " : "│   "), true);
        }
    }

    public static void prettyPrintTree(TreeNode node) {
        prettyPrintTree(node,  "", true);
    }
}
